#ifndef __M_BUSINESS_H__
#define __M_BUSINESS_H__
#include "factory.hpp"

/*              封装业务实现！！！          */

namespace zhong
{
    class Business
    {
    public:
        // 消费者业务
        static void ConsumerBusiness(const zhong::Channel::ptr &channel)
        {
            // 表示消费者
            zhong::ConsumerClient::ptr consumer = zhong::FactoryCilent::createConsumerClient(channel);
            // 1.选择虚拟机
        SELECT:
            std::cout << "请输入操作的虚拟机" << std::endl;
            std::string host_name;
            std::getline(std::cin, host_name);
            bool ret = consumer->selectVirtualHost(host_name);
            if (ret == true)
            {
                // 2.提供业务选择
            }
            else
            {
                goto SELECT;
            }

        }
        // 生产者业务
        static void ProducerBusiness(const zhong::Channel::ptr &channel)
        {
            // 表示生产者
            zhong::ProducerClient::ptr producer = zhong::FactoryCilent::createProducerClient(channel);
        SELECT:
            std::cout << "请输入操作的虚拟机" << std::endl;
            std::string host_name;
            std::getline(std::cin, host_name);
            bool ret = producer->selectVirtualHost(host_name);
            if (ret == true)
            {
                // 2.提供业务选择
            }
            else
            {
                goto SELECT;
            }

        }
        // 管理员业务
        static void ManagerBusiness(const zhong::Channel::ptr &channel)
        {
            // 表示管理员
            zhong::ManagerCilent::ptr manager = zhong::FactoryCilent::createManagerCilent(channel);
            // 1.提供业务选择
 
        }
    };
}

#endif